/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbrequer")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbrequer.findAll", query = "SELECT p FROM Pyfntbrequer p"),
    @NamedQuery(name = "Pyfntbrequer.findByPyfntbrequerid", query = "SELECT p FROM Pyfntbrequer p WHERE p.pyfntbrequerid = :pyfntbrequerid"),
    @NamedQuery(name = "Pyfntbrequer.findByNombre", query = "SELECT p FROM Pyfntbrequer p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Pyfntbrequer.findByUnidadmed", query = "SELECT p FROM Pyfntbrequer p WHERE p.unidadmed = :unidadmed"),
    @NamedQuery(name = "Pyfntbrequer.findByCodincop", query = "SELECT p FROM Pyfntbrequer p WHERE p.codincop = :codincop"),
    @NamedQuery(name = "Pyfntbrequer.findByFecharegistro", query = "SELECT p FROM Pyfntbrequer p WHERE p.fecharegistro = :fecharegistro"),
    @NamedQuery(name = "Pyfntbrequer.findByAprobacion", query = "SELECT p FROM Pyfntbrequer p WHERE p.aprobacion = :aprobacion"),
    @NamedQuery(name = "Pyfntbrequer.findByNotas", query = "SELECT p FROM Pyfntbrequer p WHERE p.notas = :notas"),
    @NamedQuery(name = "Pyfntbrequer.findByValorunit", query = "SELECT p FROM Pyfntbrequer p WHERE p.valorunit = :valorunit"),
    @NamedQuery(name = "Pyfntbrequer.findByCantidad", query = "SELECT p FROM Pyfntbrequer p WHERE p.cantidad = :cantidad"),
    @NamedQuery(name = "Pyfntbrequer.findByObservaciones", query = "SELECT p FROM Pyfntbrequer p WHERE p.observaciones = :observaciones")})
public class Pyfntbrequer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbrequerid")
    private Integer pyfntbrequerid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "unidadmed")
    private String unidadmed;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "codincop")
    private String codincop;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecharegistro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecharegistro;
    @Column(name = "aprobacion")
    private Boolean aprobacion;
    @Size(max = 255)
    @Column(name = "notas")
    private String notas;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valorunit")
    private double valorunit;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cantidad")
    private int cantidad;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @JoinColumn(name = "pyfntbtipobienid", referencedColumnName = "pyfntbtipobienid")
    @ManyToOne(optional = false)
    private Pyfntbtipobien pyfntbtipobienid;
    @JoinColumn(name = "pyfntbpoaprogid", referencedColumnName = "pyfntbpoaprogid")
    @ManyToOne(optional = false)
    private Pyfntbpoaprog pyfntbpoaprogid;
    @JoinColumn(name = "pyfntbpartidaid", referencedColumnName = "pyfntbpartidaid")
    @ManyToOne(optional = false)
    private Pyfntbpartida pyfntbpartidaid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbrequerid")
    private Collection<Pyfntbactcreq> pyfntbactcreqCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbrequerid")
    private Collection<Pyfntbreqmonto> pyfntbreqmontoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbrequerid")
    private Collection<Pyfntbpedido> pyfntbpedidoCollection;

    public Pyfntbrequer() {
    }

    public Pyfntbrequer(Integer pyfntbrequerid) {
        this.pyfntbrequerid = pyfntbrequerid;
    }

    public Pyfntbrequer(Integer pyfntbrequerid, String nombre, String unidadmed, String codincop, Date fecharegistro, double valorunit, int cantidad, String observaciones) {
        this.pyfntbrequerid = pyfntbrequerid;
        this.nombre = nombre;
        this.unidadmed = unidadmed;
        this.codincop = codincop;
        this.fecharegistro = fecharegistro;
        this.valorunit = valorunit;
        this.cantidad = cantidad;
        this.observaciones = observaciones;
    }

    public Integer getPyfntbrequerid() {
        return pyfntbrequerid;
    }

    public void setPyfntbrequerid(Integer pyfntbrequerid) {
        this.pyfntbrequerid = pyfntbrequerid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getUnidadmed() {
        return unidadmed;
    }

    public void setUnidadmed(String unidadmed) {
        this.unidadmed = unidadmed;
    }

    public String getCodincop() {
        return codincop;
    }

    public void setCodincop(String codincop) {
        this.codincop = codincop;
    }

    public Date getFecharegistro() {
        return fecharegistro;
    }

    public void setFecharegistro(Date fecharegistro) {
        this.fecharegistro = fecharegistro;
    }

    public Boolean getAprobacion() {
        return aprobacion;
    }

    public void setAprobacion(Boolean aprobacion) {
        this.aprobacion = aprobacion;
    }

    public String getNotas() {
        return notas;
    }

    public void setNotas(String notas) {
        this.notas = notas;
    }

    public double getValorunit() {
        return valorunit;
    }

    public void setValorunit(double valorunit) {
        this.valorunit = valorunit;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public Pyfntbtipobien getPyfntbtipobienid() {
        return pyfntbtipobienid;
    }

    public void setPyfntbtipobienid(Pyfntbtipobien pyfntbtipobienid) {
        this.pyfntbtipobienid = pyfntbtipobienid;
    }

    public Pyfntbpoaprog getPyfntbpoaprogid() {
        return pyfntbpoaprogid;
    }

    public void setPyfntbpoaprogid(Pyfntbpoaprog pyfntbpoaprogid) {
        this.pyfntbpoaprogid = pyfntbpoaprogid;
    }

    public Pyfntbpartida getPyfntbpartidaid() {
        return pyfntbpartidaid;
    }

    public void setPyfntbpartidaid(Pyfntbpartida pyfntbpartidaid) {
        this.pyfntbpartidaid = pyfntbpartidaid;
    }

    @XmlTransient
    public Collection<Pyfntbactcreq> getPyfntbactcreqCollection() {
        return pyfntbactcreqCollection;
    }

    public void setPyfntbactcreqCollection(Collection<Pyfntbactcreq> pyfntbactcreqCollection) {
        this.pyfntbactcreqCollection = pyfntbactcreqCollection;
    }

    @XmlTransient
    public Collection<Pyfntbreqmonto> getPyfntbreqmontoCollection() {
        return pyfntbreqmontoCollection;
    }

    public void setPyfntbreqmontoCollection(Collection<Pyfntbreqmonto> pyfntbreqmontoCollection) {
        this.pyfntbreqmontoCollection = pyfntbreqmontoCollection;
    }

    @XmlTransient
    public Collection<Pyfntbpedido> getPyfntbpedidoCollection() {
        return pyfntbpedidoCollection;
    }

    public void setPyfntbpedidoCollection(Collection<Pyfntbpedido> pyfntbpedidoCollection) {
        this.pyfntbpedidoCollection = pyfntbpedidoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbrequerid != null ? pyfntbrequerid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbrequer)) {
            return false;
        }
        Pyfntbrequer other = (Pyfntbrequer) object;
        if ((this.pyfntbrequerid == null && other.pyfntbrequerid != null) || (this.pyfntbrequerid != null && !this.pyfntbrequerid.equals(other.pyfntbrequerid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbrequer[ pyfntbrequerid=" + pyfntbrequerid + " ]";
    }
    
}
